﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace YXShop.Web.membercenter.product
{
    public partial class onlinesignupinfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ChangeHope.WebPage.PageRequest.GetQueryInt("id") > 0)
                {
                    BindInfo(ChangeHope.WebPage.PageRequest.GetQueryString("id"));
                }
            }
        }
        protected void BindInfo(string id)
        {
            YXShop.BLL.Product.GroupBuy_OnlineSignUpInfo bll = new YXShop.BLL.Product.GroupBuy_OnlineSignUpInfo();
            YXShop.BLL.Product.Product_SendGroupBuyInfo psbll = new YXShop.BLL.Product.Product_SendGroupBuyInfo();
            YXShop.Model.Product.GroupBuy_OnlineSignUpInfo model = bll.GetModelID(Convert.ToInt32(id));
            if (model != null)
            {
                this.rblAudit.SelectedValue = model.State.ToString();
                this.lbName.Text = model.Name;
                this.lbSex.Text = model.Sex.ToString();
                this.lbTel.Text = model.Tel;
                this.lbQQ.Text = model.QQ;
                this.lbCount.Text = model.Count.ToString();
                this.lbAddress.Text = model.Address;
                this.lbContent.Text = model.Content;
                this.returnLink.NavigateUrl = "onlinesignupinfo_list.aspx?w_d_sid=" + model.SID + "&q_productid=" + model.SID;
                YXShop.Model.Product.Product_SendGroupBuyInfo psmodel=psbll.GetModelID(model.SID);
                if (psmodel != null)
                {
                    this.lbActivityName.Text = psmodel.Title;
                }
            }
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Save();
        }

        protected void Save()
        {
            YXShop.BLL.Product.GroupBuy_OnlineSignUpInfo bll = new YXShop.BLL.Product.GroupBuy_OnlineSignUpInfo();
            string state = this.rblAudit.SelectedValue.ToString();
            if (bll.Amend(Convert.ToInt32(ChangeHope.WebPage.PageRequest.GetQueryString("id")), "state", state) != 0)
            {
                this.ltlMsg.Text = "操作成功.";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
        }
    }
}
